package com.bush.mall.product.controller;

import org.springframework.web.bind.annotation.*;
import com.bush.mall.common.entity.Result;;
import com.bush.mall.product.entity.CategoryBrandRelationEntity;
import com.bush.mall.product.service.CategoryBrandRelationService;
import javax.annotation.Resource;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

/**
 * 品牌分类关联
 * @author RUN
 * @date 2022-11-28
 */
@RestController
@RequestMapping("categorybrandrelation")
@Api(tags = "品牌分类关联管理" )
public class CategoryBrandRelationController {

    @Resource(name= CategoryBrandRelationService.BEAN_ID)
    private CategoryBrandRelationService categoryBrandRelationService;

    /**
     * 分页查询品牌分类关联列表
     * @author RUN
     * @date 2022-11-28
     */
    @ApiOperation(value = "分页查询品牌分类关联列表")
    @GetMapping("queryForPage")
    public Result queryForPage(Integer current,Integer size){
        return categoryBrandRelationService.queryForPage(current,size);
    }

    /**
     * 保存品牌分类关联表单
     * @author RUN
     * @date 2022-11-28
     */
    @ApiOperation(value = "保存品牌分类关联表单")
    @PostMapping("saveCategoryBrandRelation")
    public Result saveCategoryBrandRelation(@RequestBody CategoryBrandRelationEntity categoryBrandRelation){
        return categoryBrandRelationService.saveCategoryBrandRelation(categoryBrandRelation);
    }

    /**
     * 修改品牌分类关联表单
     * @author RUN
     * @date 2022-11-28
     */
    @ApiOperation(value = "修改品牌分类关联表单")
    @PutMapping("updateCategoryBrandRelation")
    public Result updateCategoryBrandRelation(@RequestBody CategoryBrandRelationEntity categoryBrandRelation){
        return categoryBrandRelationService.updateCategoryBrandRelation(categoryBrandRelation);
    }

    /**
     * 通过指定id删除品牌分类关联
     * @author RUN
     * @date 2022-11-28
     */
    @ApiOperation(value = "通过指定id删除品牌分类关联")
    @DeleteMapping("deleteCategoryBrandRelation")
    public Result deleteCategoryBrandRelation(Long id){
        return categoryBrandRelationService.deleteCategoryBrandRelation(id);
    }

}
